<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>表单添加</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="teleorderNum=no">
  <link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
  <link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
  <input type="hidden" id="id" name="id" value="${register.id}" />
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>客服名</label>
    <div class="layui-input-block">
      
      <select class="form-control" <#if kind==2>disabled</#if> lay-verify="required" id="customId">
        <#list customList as custom>
          <option value="${custom.id}" <#if custom.id==register.customId  >selected</#if> >${custom.name}</option>
        </#list>
      </select>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>旺旺号</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if> placeholder="请输入旺旺号" lay-verify="required" id="wangWang"  name="wangWang" l value="${register.wangWang}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>订单编号</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if>  placeholder="请输入订单编号" lay-verify="required" id="orderNum" name="orderNum"  value="${register.orderNum}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>微信号</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if>  placeholder="请输入微信号" lay-verify="required" id="weChat" name="weChat"  value="${register.weChat}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">进店关键词</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input"  <#if kind==2>disabled</#if>  placeholder="请输入进店关键词"  id="keyWord" name="keyWord"  value="${register.keyWord}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">进店链接</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if>  placeholder="请输入进店链接"id="url" name="url"  value="${register.url}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">微信收款码</label>
    <div class="layui-input-block">
      <div class="famous-upload-pic">
        <img  src="${register.ewm!'/image/icon_addpic.png'}" class="upload-avatar" id="upload-avatar"/>
        <input type="file" name="myfiles" class="upload" id="myFile" <#if kind==2>disabled</#if> onchange="ajaxFileUploads('myFile','ewm','upload-avatar')">
        <input type="hidden" class="ewm" id="ewm"  value="${register.ewm}" />
        <input type="button" value="预览" class="showBtn"/>
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>是否返款</label>
    <div class="layui-input-block">
      <select class="form-control" lay-verify="required" <#if kind==2>disabled</#if> id="backMoney">
      <option value="否" <#if "否"==register.backMoney  >selected</#if> >否</option>
      <option value="是" <#if "是"==register.backMoney  >selected</#if> >是</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>返款总金额</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if>  placeholder="请输入返款总金额" lay-verify="required" id="money" name="money"  value="${register.money}" autocomplete="off">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;"></span>返款日期</label>
    <div class="layui-input-block">
      <input type="text" class="layui-input returnDate" <#if kind==3>disabled</#if> id="returnDate" name="returnDate" value="${(register.returnTime?string('yyyy-MM-dd HH:mm:ss'))!''}"
      placeholder="请选择返款日期" maxlength="30" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;"></span>返款银行</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==3>disabled</#if>  placeholder="请输入返款银行" id="returnBank" name="returnBank"  value="${register.returnBank}" autocomplete="off">
    </div>
  </div>

  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">备注</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input"  <#if kind==2>disabled</#if> placeholder="请输入备注"  id="remark" name="remark"  value="${register.remark}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label">礼品</label>
    <div class="layui-input-block">
      <input type="text"  class="layui-input" <#if kind==2>disabled</#if>  placeholder="请输入礼品"  id="gift" name="gift"  value="${register.gift}" autocomplete="off">
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>店铺名称</label>
    <div class="layui-input-block">
      <select class="form-control" lay-verify="required" <#if kind==2>disabled</#if> id="storeId">
      <#list storeList as store>
        <option value="${store.id}" <#if store.id==register.storeId  >selected</#if> >${store.name}</option>
      </#list>
      </select>
    </div>
  </div>
  <div class="layui-form-item layui-row layui-col-xs12">
    <label class="layui-form-label"><span style="color: #F00;">*</span>月份</label>
    <div class="layui-input-block">
      <select class="form-control" lay-verify="required" <#if kind==2>disabled</#if> id="month">
        <option value="一月" <#if "一月"==register.month  >selected</#if> >一月</option>
        <option value="二月" <#if "二月"==register.month  >selected</#if> >二月</option>
        <option value="三月" <#if "三月"==register.month  >selected</#if> >三月</option>
        <option value="四月" <#if "四月"==register.month  >selected</#if> >四月</option>
        <option value="五月" <#if "五月"==register.month  >selected</#if> >五月</option>
        <option value="六月" <#if "六月"==register.month  >selected</#if> >六月</option>
        <option value="七月" <#if "七月"==register.month  >selected</#if> >七月</option>
        <option value="八月" <#if "八月"==register.month  >selected</#if> >八月</option>
        <option value="九月" <#if "九月"==register.month  >selected</#if> >九月</option>
        <option value="十月" <#if "十月"==register.month  >selected</#if> >十月</option>
        <option value="十一月" <#if "十一月"==register.month  >selected</#if> >十一月</option>
        <option value="十二月" <#if "十二月"==register.month  >selected</#if> >十二月</option>
      </select>
    </div>
  </div>


  <div class="layui-form-item layui-row layui-col-xs12">
    <div class="layui-input-block">
      <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="btnSubmit">确定</button>
      <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary closeLay">取消</button>
    </div>
  </div>
</form>
<script src="${s.base}/js/base/jquery-3.2.0.min.js"></script>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript" src="${s.base}/js/base/ajaxfileupload.js"></script>
<script type="text/javascript">
    layui.use(['laydate','form','layer','dialog'],function(){
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            dialog = layui.dialog,
            $ = layui.jquery;
        var laydate = layui.laydate;
        laydate.render({
            elem: '#returnDate', //指定元素
            type: 'datetime'
        });


        form.on("submit(btnSubmit)",function(data){
            //弹出loading
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            var field = data.field;
            // 实际使用时的提交信息
            $.post("/register/updateOrAddEntity",{
                id : $("#id").val(),
                customId : $("#customId").val(),
                wangWang : $("#wangWang").val(),
                orderNum : $("#orderNum").val(),
                weChat : $("#weChat").val(),
                keyWord : $("#keyWord").val(),
                url : $("#url").val(),
                ewm : $("#ewm").val(),
                gift : $("#gift").val(),
                money : $("#money").val(),
                returnDate : $("#returnDate").val(),
                returnBank : $("#returnBank").val(),
                storeId : $("#storeId").val(),
                remark : $("#remark").val(),
                month : $("#month").val(),
                backMoney:$("#backMoney").val()
            },function(result){
                if(1==result.returnInfo.state){
                    top.layer.close(index);
                    top.layer.msg("操作成功！");
                    layer.closeAll("iframe");
                    //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.msg(result.returnInfo.errorMsg);
                }
            },"json")
            return false;
        });

        //弹窗式单附件
        $(".showBtn").bind("click",function () {
            debugger
            var path = $("#ewm").val();
            dialog.imageSingleShow(path);
        });
    })
</script>
</body>
</html>